<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xftl">
<head>
<meta http-equiv="Content-Type" content="text/ftl; charset=UTF-8"/>
	<title>微信标签管理</title>
	<#include '/frame/version.html'>
	<#include '/frame/manage/include_css.html'>
	<#include '/frame/manage/include_js.html'>
	<#include '/frame/taglib.html'>
</head>
<body id="nv_member" class="pg_CURMODULE">
	<#assign current='menu_tags'>
	<div id="wp" class="wp">
		<#include "/include/header.html"/>
		<div class="contentmanage">
			<div class="developer">
				<div class="tableContent">
					<#include "/include/left.html"/>
					<#include "/include/wxtop.html"/>
 <div class="content">
    <div class="cLineB">
        <h4 class="left">
        	粉丝标签管理
        </h4>
        <div class="clr">
        </div>
    </div>
    <div class="cLine">
	        <div class="pageNavigator left">
				<a href="javascript:void(0)" onclick="addtag();" title="新增标签" class="btnGrayS">
					<img width="16" src="${basePath}/images/add.png" class="vm">新增标签
				</a>
			</div>
        <div class="pageNavigator right">
            <form action="${base}/admin/tags/list" method="post" id="form_pagination">
			 	名称：<input class="px" name="name" placeholder="请输入名称" value="${name}" maxlength="30"/>
				<input type="submit" value="搜索" class='btnGreen'/>
	            <input type="button" onclick="window.location='${basePath}/admin/tags/syn'" value="同步" class='btnGreen' />
            </form>
        </div>
        <div class="clr">
        </div>
    </div>
    <div class="msgWrap">
            <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ListProduct Shallow_border_color">
                <thead>
                    <tr>
						<th style="width:50px;">编号</th>
						<th>标签名称</th>
						<th>归属</th>
						<th>标签下用户数</th>
						<#if roleId==0>
						<th>操作</th>
						</#if>
                    </tr>
                </thead>
                <tbody>
                <#if page?exists>
                <#list page.recordList as bean >
                    <tr>
                       <td valign="middle" align="center">${page.pernum*(page.currentPage-1)+bean_index+1}</td>
                        <td><a href="javascript:void(0)" onclick="tagCust('${bean.tagId}')" >${bean.tagName}</a> </td><!--_${bean.tagStatus}-->
                        <td><#if bean.tagStatus==0>本地
							<#elseif bean.tagStatus==1>微信</#if></td>
                        <td>${bean.tagCount}</td>
                        <#if roleId==0>
	                        <td align="center" class="norightborder">
	                            <#if bean.tagId != 0 && bean.tagId != 1 && bean.tagId != 2>
		                            <a href="javascript:void(0)" onclick="deltag('${bean.id}', '${bean.tagStatus}');">删除</a>
		                            <a href="javascript:void(0)" onclick="updatetag('${bean.id}', '${bean.tagName}');">修改</a>
		                            <#if bean.tagStatus==0><a href="javascript:void(0)" onclick="conversion('wechat', '${bean.id}', this)">转换至微信</a>
									<#elseif bean.tagStatus==1><a href="javascript:void(0)" onclick="conversion('local', '${bean.id}', this)">转换至本地</a></#if>
	                            </#if>
	<!--                             <a href="javascript:void(0)" onclick="chooseFans(${bean.tagId})">选择粉丝</a> -->
	                        </td>
                        </#if>
                    </tr>
                    </#list>
                    </#if>
                </tbody>
            </table>
    </div>
    <#include "/include/form_pagination.html"/>
    <#include "/include/simple_page_js.html"/>
  </div>
 <div class="clr"></div>
 </div>
 </div>
 </div>
</div>
<#include "/include/footer.html"/>
<script type="text/javascript" src="${base}/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
function tagCust(localId) {
	window.location='${basePath}/admin/tags/cust?localId=' + localId;
}


function exportExcel(that){
    var $form = $(that).closest("form");
    $form.submit();
}
function addtag(){
	stem.confirm("<select name='lable' id='lable' style='width: 150px; '><option value='1'>微信标签</option><option value='2'>本地标签</option></select> " +
            "<br>标签名称：<input id='tagname' name='name' placeholder='请输入名称'  maxlength='30' class='px'/>","添加标签",function(){
		if($("#tagname").val()==""){
		stem.info("请填写标签名称");
		return false;
		}
		jQuery.ajax({type:'POST',
	              url:'${basePath}/admin/tags/addt',
				  data:{"name":$("#tagname").val(), "lable" : $("#lable").val()},
				
			   success:function(data){
			   		if(data=="success"){
				   		window.location='${basePath}/admin/tags/list';
			   		}else if(data=="name"){
			   			stem.info("标签名重复");
			   		}else if(data=="out"){
			   			stem.info("创建的标签数过多，请注意不能超过100个");
			   		}else{
			   			stem.info("创建失败");
			   		}
				  }    
	          	
	    });
	});
}
</script>
</body>
</html>